import fetch from 'common/src/utils/fetch'

let api = {
    // 查询列表
    getList(data) {
        return fetch({
            url: '/api/designservice/scoreWeight/list',
            method: 'post',
            headers: {
                'Content-Type': 'application/json'
            },
            data
        })
    },
    // 查选择课程
    getCourseList(data) {
        return fetch({
            url: '/api/designservice/CourseSelection/findCourse',
            method: 'post',
            headers: {
                'Content-Type': 'application/json'
            },
            data
        })
    },
    // 查校历id
    getCalendarId() {
        return fetch({
            url: '/api/baseresservice/schoolCalendar/currentTermCalendar',
            method: 'get',
            headers: {
                'Content-Type': 'application/json'
            }
        })
    },
    // 查校历信息
    getSchoolCalendar(id) {
        return fetch({
            url: `/api/baseresservice/schoolCalendar/${id}`,
            method: 'get',
            headers: {
                'Content-Type': 'application/json'
            }
        })
    },
    // 导出
    export(data, type) {
        return fetch({
            url: `/api/designservice/CourseSelection/exportStudents?type=${type}`,
            method: 'post',
            headers: {
                'Content-Type': 'application/json'
            },
            data
        })
    },
    // 选择课程提交
    insertCourse(data) {
        return fetch({
            url: '/api/designservice/CourseSelection/insertCourse',
            method: 'post',
            headers: {
                'Content-Type': 'application/json'
            },
            data
        })
    },
    getExportStatus(key) {
        return fetch({
            url: `/api/designservice/common/exportExcelResult/${key}`,
            method: 'get',
            showMask: false
        })
    },
    // 查数据字典
    queryDic(data) {
        let authId = localStorage.getItem('activeAuthId')
        if (authId) {
            data['authId'] = authId
        }
        return fetch({
            url: '/api/commonservice/dictionary/query',
            method: 'post',
            headers: {
                'Content-Type': 'application/json'
            },
            data
        })
    },
    // 查学院
    getCollege() {
        let authId = localStorage.getItem('activeAuthId')
        return fetch({
            url: `/api/designservice/common/college?authId=${authId}`,
            method: 'get',
            headers: {
                'Content-Type': 'application/json'
            }
        })
    },
    // 根据年份和学院查专业
    getSubject(college, grade) {
        return fetch({
            url: `/api/designservice/common/findSubjectByCurrentGrade?college=${college}&gradeId=${grade}`,
            method: 'get',
            headers: {
                'Content-Type': 'application/json'
            }
        })
    }
}

export default api
